import UIManager from "../../framework/uiMoudle/UIManager";
import AudioManager from "../../framework/AudioManager";
import MoudleName from "../../framework/MoudleName";
import BasePanel from "../../framework/BasePanel";


@ccclass
@inspector
class loadScene extends BasePanel<loadScene> {

    onLoad() {
        //第一个场景不会自动执行onShow
        this.onShow();

        // UIManager.loadAssets('core', (press, isCompleted) => {
        // if (isCompleted) {
        (cc.Button.prototype as any)._onTouchEnded = function (t) {
            //禁止按钮连续点击
            if (this.safe) return console.warn('禁止0.5s内按钮连续点击');
            this.safe = true;
            this.scheduleOnce(() => {
                this.safe = false;
            }, 0.5);
            //设置全按钮的点击音效
            if (this.isMuc == null) {
                AudioManager.playEffect(MoudleName.core.get('click'));
            }
            if (this.interactable && this.enabledInHierarchy) {
                if (this._pressed) {
                    cc.Component.EventHandler.emitEvents(this.clickEvents, t);
                    this.node.emit("click", this);
                }
                this._pressed = !1;
                this._updateState();
                t.stopPropagation();
            }
        };
        UIManager.replaceScene('homeScene');
        // }
        // })
    }

    start() {

    }

    onDestroy() {

    }
    setData(data) {
        super.setData(data);
    }

    onShow() {
        super.onShow();
    }

    onHide() {
        super.onHide();
    }

    // update (dt) {}
}


